package com.wwwc.web.index.servlet;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.ServletRequestWrapper;
import java.security.*;
import java.io.*;
import java.net.*;

public class abcServlet extends HttpServlet
{
    public void doPost(HttpServletRequest request, HttpServletResponse response) {
	String[] parameters = request.getParameterValues("Parameters");

	try{
	    PrintWriter out = response.getWriter();
	    response.setContentType("text/html");

	    if(parameters == null || parameters.length == 0){
		for(int i=0; i<parameters.length;i++) {
		    out.println("<BR>"+parameters[i]);
		}
	    }
	}
	catch (Exception e) {
	    System.out.println("abcServlet:Exception:dpPost:"+e);
	}
    }

    public void doGet(HttpServletRequest request, HttpServletResponse response) {
	try {
	    PrintWriter out = response.getWriter();
	    response.setContentType("text/html");
	    StringBuffer sbf = new StringBuffer();
	    sbf.append("<HTML><HEAD><TITLE>Test form</TITLE>");
	    sbf.append("</HEAD><BODY><CENTER>");
	    sbf.append("<FORM method=post abcServlet>");
	    sbf.append("<TABLE>");
	    sbf.append("<TR><TD>P1:");
	    sbf.append("<input type=text name=p1>");
	    sbf.append("</TD></TR>");
	    sbf.append("<TR><TD>P2");
	    sbf.append("<input type=text name=p2>");
	    sbf.append("</TD></TR>");
	    sbf.append("<TR><TD>");
	    sbf.append("<input type=submit name=B value=Submit>");
	    sbf.append("</TD></TR>");
	    sbf.append("</TABLE>");
	    sbf.append("</FORM>");
	    sbf.append("</CENTER></BODY></HTML>");
	    out.println(sbf);
	}
	catch (Exception e) {
	    System.out.println("abcServlet:Exception:doGet:"+e);
	}
    }
}

